home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 3 of 3.iso
/
chapte17
/
mixer2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-04-29
|
30KB
|
860 lines
#include <windows.h>
#include <stdio.h>
#include "mixer2.h"
#if defined (WIN32)
#define IS_WIN32 TRUE
#else
#define IS_WIN32 FALSE
#endif
#define IS_NT IS_WIN32 && (BOOL)(GetVersion() < 0x80000000)
#define IS_WIN32S IS_WIN32 && (BOOL)(!(IS_NT) && (LOBYTE(LOWORD(GetVersion()))<4))
#define IS_WIN95 (BOOL)(!(IS_NT) && !(IS_WIN32S)) && IS_WIN32
HINSTANCE hInst; // current instance
LPCTSTR lpszAppName = "MyApp";
LPCTSTR lpszTitle = "mixerGetControlDetails()";
BOOL RegisterWin95( CONST WNDCLASS* lpwc );
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (hInstance, lpszAppName);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = lpszAppName;
wc.lpszClassName = lpszAppName;
if ( IS_WIN95 )
{
if ( !RegisterWin95( &wc ) )
return( FALSE );
}
else if ( !RegisterClass( &wc ) )
return( FALSE );
hInst = hInstance;
hWnd = CreateWindow( lpszAppName,
lpszTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
NULL,
NULL,
hInstance,
NULL
);
if ( !hWnd )
return( FALSE );
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
while( GetMessage( &msg, NULL, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return( msg.wParam );
}
BOOL RegisterWin95( CONST WNDCLASS* lpwc )
{
WNDCLASSEX wcex;
wcex.style = lpwc->style;
wcex.lpfnWndProc = lpwc->lpfnWndProc;
wcex.cbClsExtra = lpwc->cbClsExtra;
wcex.cbWndExtra = lpwc->cbWndExtra;
wcex.hInstance = lpwc->hInstance;
wcex.hIcon = lpwc->hIcon;
wcex.hCursor = lpwc->hCursor;
wcex.hbrBackground = lpwc->hbrBackground;
wcex.lpszMenuName = lpwc->lpszMenuName;
wcex.lpszClassName = lpwc->lpszClassName;
// Added elements for Windows 95.
//...............................
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.hIconSm = LoadImage(wcex.hInstance, lpwc->lpszClassName,
IMAGE_ICON, 16, 16,
LR_DEFAULTCOLOR );
return RegisterClassEx( &wcex );
}
#define MSG_LEN 1024
char msg[MSG_LEN+1];
MMRESULT rc;
UINT nDevId = 0;
HMIXER hmx = NULL;
HWND hControlDlg = NULL; // handle to the volume control dialog if open
// so that we can forward mixer messages.
VOID AdjustMainVolume(HWND hWnd);
VOID LocateVolumeControl(HWND hWnd, DWORD dwLineId);
BOOL CALLBACK DisplayControlDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch( uMsg )
{
case WM_COMMAND :
switch( LOWORD( wParam ) )
{
case IDM_TEST:
{
// check if there are any mixers installed
//........................................
if (mixerGetNumDevs() == 0)
{
MessageBox(hWnd, "No audio mixer devices found.",
NULL, MB_OK);
DestroyWindow(hWnd); // shut down. app is not of any use.
break;
}
// open first mixer device installed
// most systems only have one
//..................................
rc = mixerOpen(&hmx, nDevId, (DWORD)hWnd, (DWORD)NULL,
CALLBACK_WINDOW);
if (rc != MMSYSERR_NOERROR)
{
MessageBox(hWnd, "Error opening mixer DevId = 0",
NULL, MB_OK);
mixerClose(hmx);
DestroyWindow(hWnd); // shut down
break;
}
// modify master volume control
//.............................
AdjustMainVolume(hWnd);
// close mixer
//............
mixerClose(hmx);
}
break;
case IDM_ABOUT :
DialogBox( hInst, "AboutBox", hWnd, About );
break;
case IDM_EXIT :
DestroyWindow( hWnd );
break;
}
break;
// if the volume control dialog is active,
// forward the MM_MIXM_LINE_CHANGE and MM_MIXM_CONTROL_CHANGE
// messages to it.
//...........................................................
case MM_MIXM_LINE_CHANGE:
{
if (hControlDlg)
SendMessage(hControlDlg, MM_MIXM_LINE_CHANGE, wParam, lParam);
}
break;
case MM_MIXM_CONTROL_CHANGE:
{
if (hControlDlg)
SendMessage(hControlDlg, MM_MIXM_CONTROL_CHANGE, wParam, lParam);
}
break;
case WM_DESTROY :
PostQuitMessage(0);
break;
default :
return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
}
return( 0L );
}
VOID AdjustMainVolume(HWND hWnd)
{
UINT uDest;
MIXERCAPS mxcaps;
MIXERLINE mxl;
// search for main line output speakers
//.....................................
mxcaps.cDestinations = 0;
mixerGetDevCaps(nDevId, &mxcaps, sizeof(MIXERCAPS));
for (uDest = 0; uDest < mxcaps.cDestinations; uDest++)
{
mxl.cbStruct = sizeof(mxl);
mxl.dwDestination = uDest;
// get line info
//..............
rc = mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_DESTINATION);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerGetLineInfo(dst=%u) failed. rc=%u!",
uDest, rc);
MessageBox(hWnd, msg, NULL, MB_OK);
continue;
}
if (mxl.dwComponentType == MIXERLINE_COMPONENTTYPE_DST_SPEAKERS)
{
//MessageBox(hWnd, "Found it...", NULL, MB_OK);
LocateVolumeControl(hWnd, mxl.dwLineID);
return;
}
}
MessageBox(hWnd, "Error, 'main line output speakers'"
" component not found!", NULL, MB_OK);
}
VOID LocateVolumeControl(HWND hWnd, DWORD dwLineID)
{
MMRESULT rc;
MIXERLINE mxl;
MIXERLINECONTROLS mxlc;
PMIXERCONTROL paMixerControls; // pamxctrl;
MIXERDLGDATA mdd; // used to pass data to DisplayControlDlg
mxl.cbStruct = sizeof(MIXERLINE);
mxl.dwLineID = dwLineID;
rc = mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_LINEID);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg,"mixerGetLineInfo(lineid=%.08lXh) failed. rc=%u!",
dwLineID, rc);
MessageBox(hWnd, msg, NULL, MB_OK);
return;
}
if (mxl.cControls == 0)
{
MessageBox(hWnd, "There are no controls associated with the selected line.",
NULL, MB_OK);
return;
}
// allocate memory for array of PMIXERCONTROL's
//.............................................
paMixerControls = (PMIXERCONTROL)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(MIXERCONTROL) * mxl.cControls);
if (!paMixerControls)
{
MessageBox(hWnd, "Unable to allocate memory needed...", NULL, MB_OK);
return;
}
// setup MIXERLINECONTROLS sttructure
//...................................
mxlc.cbStruct = sizeof(mxlc);
mxlc.dwLineID = dwLineID;
mxlc.dwControlID = 0;
mxlc.dwControlType = 0;
mxlc.cControls = mxl.cControls;
mxlc.cbmxctrl = sizeof(MIXERCONTROL);
mxlc.pamxctrl = paMixerControls;
rc = mixerGetLineControls((HMIXEROBJ)hmx, &mxlc, MIXER_GETLINECONTROLSF_ALL);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerGetLineControls(ctrlid=%.08lXh) failed. rc=%u!",
dwLineID, rc);
MessageBox(hWnd, msg, NULL, MB_OK);
// will exit after freeing allocated memory
}
else
{
UINT u;
for (u = 0; u < mxlc.cControls; u++)
{
if (paMixerControls[u].dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
{
// verify that we have the right control
//......................................
if ( !(paMixerControls[u].dwControlType & MIXERCONTROL_CONTROLTYPE_VOLUME) )
{
sprintf(msg, "Incorrect control type (dwControlType=%.08lXh).",
paMixerControls[u].dwControlType);
MessageBox(hWnd, msg, NULL, MB_OK);
return;
}
// verify that control is active, otherwise, we can't
// modify it, which is the whole point...
//...................................................
if (paMixerControls[u].fdwControl & MIXERCONTROL_CONTROLF_DISABLED)
{
sprintf(msg, "This control (ctrlid=%.08lXh) is disabled.",
paMixerControls[u].dwControlID);
MessageBox(hWnd, msg, NULL, MB_OK);
return;
}
// okay, now it's time to popup the control dialog
// this stuff needs to be sent to the dialog
//................................................
mdd.pmxl = &mxl;
mdd.pmxctrl = &paMixerControls[u];
DialogBoxParam(hInst,
"DisplayControlDlg",
hWnd,
DisplayControlDlg,
(LPARAM)(LPVOID)&mdd);
// free array of mixer controls
//.............................
HeapFree(GetProcessHeap(), 0, paMixerControls);
return;
}
}
MessageBox(hWnd, "Unable to find volume control...", NULL, MB_OK);
return;
}
HeapFree(GetProcessHeap(), 0, paMixerControls);
}
BOOL CALLBACK DisplayControlDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static LPMIXERDLGDATA pmdd = NULL;
static LPMIXERLINE pmxl = NULL;
static LPMIXERCONTROL pmxctrl = NULL;
static MIXERCONTROLDETAILS_UNSIGNED* pmxcdu = NULL;
static int nRange = 0;
static int nPageInc = 0;
UINT nChannels;
UINT nMultipleItems;
switch (uMsg)
{
// init dialog
//.............
case WM_INITDIALOG:
hControlDlg = hDlg; // setup global handle so mixer messages
// can be forwarded from the main
// message loop
pmdd = (LPMIXERDLGDATA)lParam;
if (pmdd == NULL)
{
EndDialog(hDlg, FALSE);
return(TRUE);
}
pmxl = pmdd->pmxl;
pmxctrl = pmdd->pmxctrl;
SetDlgItemText(hDlg, IDC_SHORTNAME_EC, pmxctrl->szShortName);
SetDlgItemText(hDlg, IDC_LONGNAME_EC, pmxctrl->szName);
sprintf(msg, "dwMinimum=%lu, dwMaximum=%lu",
pmxctrl->Bounds.dwMinimum,
pmxctrl->Bounds.dwMaximum);
SetDlgItemText(hDlg, IDC_BOUNDS_EC, msg);
sprintf(msg, "cSteps=%lu", pmxctrl->Metrics.cSteps);
SetDlgItemText(hDlg, IDC_METRICS_EC, msg);
nChannels = (UINT)pmxl->cChannels;
if (pmxctrl->fdwControl & MIXERCONTROL_CONTROLF_UNIFORM)
nChannels = 1;
nMultipleItems = 1;
if (pmxctrl->fdwControl & MIXERCONTROL_CONTROLF_MULTIPLE)
nMultipleItems = (UINT)pmxctrl->cMultipleItems;
pmxcdu = (MIXERCONTROLDETAILS_UNSIGNED*)
HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
nChannels * nMultipleItems *
sizeof(MIXERCONTROLDETAILS_UNSIGNED)
);
if (pmxcdu == NULL)
{
MessageBox(hDlg, "Unable to allocate required memory...", NULL, MB_OK);
EndDialog(hDlg, FALSE);
return(TRUE);
}
nRange = (int)min(32767, pmxctrl->Metrics.cSteps - 1);
nPageInc = nRange / 10;
if (nPageInc == 0)
nPageInc = 1;
// setup scoll bars
//..................
{
int nSbWidth;
HWND hSB;
RECT rcM;
RECT rcU;
UINT u;
UINT v;
UINT uIndex;
nSbWidth = GetSystemMetrics(SM_CXVSCROLL);
GetWindowRect(GetDlgItem(hDlg, IDC_MULTICHANNEL_GRP), &rcM);
InflateRect(&rcM, -10, -20);
ScreenToClient(hDlg, (LPPOINT)&rcM.left);
ScreenToClient(hDlg, (LPPOINT)&rcM.right);
rcM.right = rcM.left + nSbWidth;
for (u = 0; u < nChannels; u++)
{
for (v = 0; v < nMultipleItems; v++)
{
uIndex = (u * nMultipleItems) + v;
hSB = CreateWindow("scrollbar", "",
WS_VISIBLE | WS_CHILD | SBS_VERT | WS_TABSTOP,
rcM.left, rcM.top,
rcM.right - rcM.left,
rcM.bottom - rcM.top,
hDlg, (HMENU)(IDCB_MULTICHANNEL + uIndex),
hInst, NULL);
SetScrollRange(hSB, SB_CTL, 0, nRange, FALSE);
rcM.left += nSbWidth + 4;
rcM.right += nSbWidth + 4;
}
// add more separation space between scroll bars
//..............................................
rcM.left += nSbWidth;
rcM.right += nSbWidth;
}
hSB = GetDlgItem(hDlg, IDC_UNIFORM_GRP);
GetWindowRect(hSB, &rcU);
InflateRect(&rcU, -10, -20);
ScreenToClient(hDlg, (LPPOINT)&rcU.left);
ScreenToClient(hDlg, (LPPOINT)&rcU.right);
rcU.right = rcU.left + nSbWidth;
for (v = 0; v < nMultipleItems; v++)
{
hSB = CreateWindow("scrollbar", "",
WS_VISIBLE | WS_CHILD | SBS_VERT | WS_TABSTOP,
rcU.left, rcU.top,
rcU.right - rcU.left,
rcU.bottom - rcU.top,
hDlg, (HMENU)(IDCB_UNIFORM + v),
hInst, NULL);
SetScrollRange(hSB, SB_CTL, 0, nRange, FALSE);
rcU.left += nSbWidth + 4;
rcU.right += nSbWidth + 4;
}
SendMessage(hDlg, MM_MIXM_LINE_CHANGE,
(WPARAM)hmx, pmxl->dwLineID);
SendMessage(hDlg, MM_MIXM_CONTROL_CHANGE,
(WPARAM)hmx, pmxctrl->dwControlID);
}
return(TRUE);
// mixer line change
//..................
case MM_MIXM_LINE_CHANGE:
{
DWORD dwLineID;
MIXERLINE mxl;
BOOL bSource;
BOOL bActive;
BOOL bDisconnected;
dwLineID = (DWORD)lParam;
if (pmxl->dwLineID != dwLineID)
return(TRUE); // not our mixer line
// get current state of mixer line
//................................
mxl.cbStruct = sizeof(MIXERLINE);
mxl.dwLineID = dwLineID;
rc = mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_LINEID);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerGetLineInfo(lineid=%.08lXh) failed. rc=%u!",
dwLineID, rc);
MessageBox(hDlg, msg, NULL, MB_OK);
return (FALSE);
}
bSource = (MIXERLINE_LINEF_SOURCE & mxl.fdwLine) != 0;
bActive = (MIXERLINE_LINEF_ACTIVE & mxl.fdwLine) != 0;
bDisconnected = (MIXERLINE_LINEF_DISCONNECTED & mxl.fdwLine) != 0;
sprintf(msg, "(%s), '%s', %s, %s",
bSource ? (LPSTR)"Src" : (LPSTR)"Dest",
(LPSTR)mxl.szShortName,
bActive ? (LPSTR)"Active" : (LPSTR)"Inactive",
bDisconnected ? (LPSTR)"Disconnected" : (LPSTR)"Connected");
SetDlgItemText(hDlg, IDC_LINEINFO_EC, msg);
}
return (TRUE);
// mixer control change
//.....................
case MM_MIXM_CONTROL_CHANGE:
{
HWND hFocus;
HWND hSB;
UINT uIndex, u, v;
int nValue;
MIXERCONTROLDETAILS mxcd;
hFocus = GetFocus();
if (hFocus == NULL)
{
hFocus = GetDlgItem(hDlg, IDCB_MULTICHANNEL);
}
else
{
if (GetDlgCtrlID(hFocus) < IDCB_MULTICHANNEL)
hFocus = GetDlgItem(hDlg, IDCB_MULTICHANNEL);
}
nChannels = (UINT)pmxl->cChannels;
if (pmxctrl->fdwControl & MIXERCONTROL_CONTROLF_UNIFORM)
nChannels = 1;
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = pmxctrl->dwControlID;
mxcd.cChannels = nChannels;
mxcd.cMultipleItems = pmxctrl->cMultipleItems;
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mxcd.paDetails = pmxcdu;
rc = mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, MIXER_GETCONTROLDETAILSF_VALUE);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerGetControlDetails(ctrlid=%.08lXh) failed. rc=%u!",
pmxctrl->dwControlID, rc);
MessageBox(hDlg, msg, NULL, MB_OK);
return (FALSE);
}
nMultipleItems = 1;
if (pmxctrl->fdwControl & MIXERCONTROL_CONTROLF_MULTIPLE)
nMultipleItems = (UINT)pmxctrl->cMultipleItems;
for (u = 0; u < nChannels; u++)
{
for (v = 0; v < nMultipleItems; v++)
{
uIndex = (u * nMultipleItems) + v;
nValue = (int)MulDiv(pmxcdu[uIndex].dwValue, nRange, 0xFFFF);
hSB = GetDlgItem(hDlg, IDCB_MULTICHANNEL + uIndex);
if (hSB == hFocus)
{
sprintf(msg, "step=%d, dwValue=%lu",
nValue, pmxcdu[uIndex].dwValue);
SetDlgItemText(hDlg, IDC_VALUE_EC, msg);
}
if (GetScrollPos(hSB, SB_CTL) == (nRange - nValue) )
continue;
// Fader controls increase as the thumb is moved up
// contrary to normal operation or a ScrollBar, so
// the action will be reversed
//..................................................
SetScrollPos(hSB, SB_CTL, nRange - nValue, TRUE);
}
}
// okay, now lets do the whole thing over again
// for the uniform controls
//.............................................
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = pmxctrl->dwControlID;
mxcd.cChannels = 1;
mxcd.cMultipleItems = pmxctrl->cMultipleItems;
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mxcd.paDetails = pmxcdu;
rc = mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, MIXER_GETCONTROLDETAILSF_VALUE);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerGetControlDetails(ctrlid=%.08lXh) failed. rc=%u!",
pmxctrl->dwControlID, rc);
MessageBox(hDlg, msg, NULL, MB_OK);
return (FALSE);
}
for (v = 0; v < nMultipleItems; v++)
{
nValue = (int)MulDiv(pmxcdu[v].dwValue, nRange, 0xFFFF);
hSB = GetDlgItem(hDlg, IDCB_UNIFORM + v);
if (hSB == hFocus)
{
sprintf(msg, "step=%d, dwValue=%lu",
nValue, pmxcdu[0].dwValue);
SetDlgItemText(hDlg, IDC_VALUE_EC, msg);
}
if (GetScrollPos(hSB, SB_CTL) == (nRange - nValue) )
continue;
// Fader controls increase as the thumb is moved up
// contrary to normal operation or a ScrollBar, so
// the action will be reversed
//..................................................
SetScrollPos(hSB, SB_CTL, nRange - nValue, TRUE);
}
}
return (TRUE);
// vertical scroll
//................
case WM_VSCROLL:
{
int nValue;
UINT uID;
HWND hSB;
SHORT nPos;
MIXERCONTROLDETAILS mxcd;
hSB = (HWND)lParam;
nPos = (SHORT)HIWORD(wParam);
uID = GetDlgCtrlID(hSB);
if (uID < IDCB_UNIFORM)
{
nChannels = (UINT)pmxl->cChannels;
uID -= IDCB_MULTICHANNEL;
if (pmxctrl->fdwControl & MIXERCONTROL_CONTROLF_UNIFORM)
nChannels = 1;
}
else
{
nChannels = 1;
uID -= IDCB_UNIFORM;
}
nValue = GetScrollPos(hSB, SB_CTL);
switch ( LOWORD(wParam) )
{
case SB_PAGEUP:
nValue -= nPageInc;
nValue = (nValue < 1) ? 0 : (nValue - 1);
break;
case SB_PAGEDOWN:
nValue = (int)min(nRange, (LONG)nValue + nPageInc);
break;
case SB_LINEUP:
nValue = (nValue < 1) ? 0 : (nValue - 1);
break;
case SB_LINEDOWN:
nValue = (int)min(nRange, (LONG)nValue + 1);
break;
case SB_TOP:
nValue = 0;
break;
case SB_BOTTOM:
nValue = nRange;
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
nValue = nPos;
break;
default:
return(FALSE);
}
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = pmxctrl->dwControlID;
mxcd.cChannels = nChannels;
mxcd.cMultipleItems = pmxctrl->cMultipleItems;
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mxcd.paDetails = pmxcdu;
rc = mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, 0L);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerGetControlDetails(ctrlid=%.08lXh) failed. rc=%u!",
pmxctrl->dwControlID, rc);
MessageBox(hDlg, msg, NULL, MB_OK);
return (FALSE);
}
pmxcdu[uID].dwValue = (DWORD)MulDiv((nRange - nValue), 0xFFFF, nRange);
rc = mixerSetControlDetails((HMIXEROBJ)hmx, &mxcd, 0L);
if (rc != MMSYSERR_NOERROR)
{
sprintf(msg, "mixerSetControlDetails(ctrlid=%.08lXh) failed. rc=%u!",
pmxctrl->dwControlID, rc);
MessageBox(hDlg, msg, NULL, MB_OK);
return (FALSE);
}
}
return (TRUE);
// commands
//.........
case WM_COMMAND:
switch ( LOWORD(wParam) )
{
// close down volume control dialog
//.................................
case WM_CLOSE:
case IDOK:
case IDCANCEL:
{
HeapFree(GetProcessHeap(), 0, pmxcdu);
EndDialog(hDlg, TRUE);
hControlDlg = NULL;
}
break;
}
break;
}
return (FALSE);
}
LRESULT CALLBACK About( HWND hDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return (TRUE);
case WM_COMMAND:
if ( LOWORD(wParam) == IDOK
|| LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return (FALSE);
}